<?php
/**
 * GeryEngine
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this release in the file LICENSE
 *
 * @copyright  Copyright (c) 2007 Arjen Brouwer
 * @license    New BSD License
 * @author     Arjen Brouwer
 */

class Resource {

	private $name;
	private $lastModified;
	private $data;
	
	/**
	 * The resource loader that loaded this resource
	 *
	 * @var ResourceLoader
	 */
	private $resourceLoader;
	
	public function __construct($name, $data, $lastModified, ResourceLoader $resourceLoader) {
		$this->name = $name;
		$this->data = $data;
		$this->lastModified = $lastModified;
		$this->resourceLoader = $resourceLoader;
	}
	
	public function getName() {
		return $this->name;
	}
	
	public function getLastModified() {
		return $this->lastModified;
	}
	
	public function getData() {
		return $this->data;
	}
	
	/**
	 * Get the ResourceLoader that loaded this resource
	 *
	 * @return ResourceLoader
	 */
	public function getResourceLoader() {
		return $this->resourceLoader;
	}
	
	/**
	 * Check whether or not this resource may be cached or not
	 *
	 * @return boolean True if this resource may be cached - False otherwise
	 */
	public function isCachable() {
		return $this->resourceLoader->isResourceCachable($this);
	}
}
?>